/*
 * Copyright (c) 2013 Tob
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package de.tudarmstadt.kom.androidsensorapi.sensor.data.concrete;

import android.test.AndroidTestCase;

import java.util.Date;

import de.tudarmstadt.kom.androidsensorapi.sensor.data.concrete.LocationSensorData;
import de.tudarmstadt.kom.androidsensorapi.datarepresentation.location.SimpleLocation;
import de.tudarmstadt.kom.androidsensorapi.datarepresentation.location.LocationProvider;

/**
 * Created by Tobias Welther
 */
public class LocationSensorDataTest extends AndroidTestCase{

    private SimpleLocation location1;
    private SimpleLocation location2;

    private LocationSensorData locationData1;
    private LocationSensorData locationData2;

    @Override
    public void setUp() throws Exception {
        super.setUp();

        location1 = new SimpleLocation(13, 37, 0, 12, 12);
        location2 = new SimpleLocation(24, 24, Double.MIN_VALUE, Double.MIN_VALUE, Double.MIN_VALUE);

        locationData1 = new LocationSensorData(new Date(), location1, LocationProvider.GPS);
        locationData2 = new LocationSensorData(new Date(), location2, LocationProvider.CELL);
    }


    public void testGetProvider() throws Exception {
        assertEquals(LocationProvider.GPS, locationData1.getProvider());
        assertEquals(LocationProvider.CELL, locationData2.getProvider());
    }

    public void testGetLocation() throws Exception {
        assertEquals(location1, locationData1.getLocation());
        assertEquals(location2, locationData2.getLocation());
    }

    public void testGetDateOfCreation() throws Exception {
        Date currentDate = new Date();
        assertEquals(currentDate, locationData1.getDateOfCreation());
        assertEquals(currentDate, locationData2.getDateOfCreation());
    }
}
